package com.rgs.oauth2gateway.feignClient;

import com.rgs.oauth2gateway.pojo.auth.AuthorizationDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author RenGaoshuai
 * @date 2024/4/11 16:44
 * @description 认证服务
 */
@FeignClient(contextId = "authTokenFeignClient", value = "oauth-auth")
public interface AuthTokenFeignClient {

    /**
     * 调用认证服务的获取token接口（该接口是oauth自带的接口）
     * @param scope
     * @param grantType
     * @param authorization
     * @return
     */
    @PostMapping("/oauth/token")
    AuthorizationDTO getToken(@RequestParam("scope") String scope,
                              @RequestParam("grant_type") String grantType,
                              @RequestHeader("Authorization") String authorization);
}
